<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 用户名  密码  重新输入密码  手机号 -->
		<form>
			<label>用户名:</label><input id="username" type = "text"  placeholder="请设置用户名"/>
			<span  id="msg"></span>
		</form>
		<script>
			document.getElementById('username').onblur = function(){
				msg = document.getElementById("msg")
				if(8 <this.value.length && this.value.length <16){
					msg.innerHTML = "用户名合法"
					msg.style.color = "red"
				}else{
					msg.innerHTML = "用户名不合法"
					msg.style.color = "red"
				}
			}
			
		</script>
	</body>
</html>
